Computing II - Sports Betting Predictions Project

Java
Vaadin
API integration
TableSaw
SMILE machine learning
Author

Landon Jordan, Haidyn Murphy

Published

May 6, 2025

This entry showcases our completed Computing II project, which integrates live API data, Java-based back-end processing, and predictive analytics to deliver sports betting insights. The core concept centers around enabling users to select a sport and player of interest, view available betting lines, and utilize our predictive model to estimate the probability of a specific bet outcome.

Our UI is developed using the Vaadin framework, while live sports data is retrieved via the Sports Game Odds API. Predictive modeling is performed with the SMILE machine learning library to generate probability estimates for over/under prop bets. Additionally, parlay optimization is implemented using Google OR-Tools.

The accompanying slides include detailed descriptions of our design approach, and notable features throughout our code.

The “fetchAllEventsWithOdds” method is responsible for retrieving a comprehensive list of games for a specified sport by interfacing with the Sports Game Odds API. It systematically iterates through all available pages of game data, extracting essential details such as team matchups and associated betting lines. This method played a critical role in ensuring complete coverage of betting markets across major leagues, including the NBA, NFL, and MLB.

The “fetchPlayerStats” method accepts both an event ID and a player ID, then queries the API to retrieve statistical data specific to that player within the designated game. It filters for relevant performance metrics such as: points, assists, shots on goal, and hits and then organizes the results into a key-value map structure for seamless integration with our prediction model.

The “Sport” class was designed to encapsulate key information for each sport retrieved from the API, including the sport’s name, league ID, and whether it differentiates between meaningful home-and-away matchups. An early challenge we encountered involved the varying terminology used across sports for core statistics. For example, basketball tracks “points,” baseball refers to “runs,” and hockey uses terms like “goals” or “shots on goal”. To address this inconsistency without resorting to sport-specific hardcoded logic, we introduced the “PointWord” and “EventWord” classes. These objects serve as repositories for sport-specific terminology, enabling the UI to dynamically access the correct labels and statistical values in a standardized manner.

All dropdown menus, are implemented using Vaadin’s ComboBox component. Upon selecting a sport, the interface dynamically presents corresponding dropdowns for team, player, and statistic type. These components are arranged in a vertical layout to maintain a clean, organized structure, ensuring a straightforward and consistent user experience across all supported sports.

The second page of our GUI was responsible for the actual model that predicted the likelihood of any player bet hitting over that inputted line. The structure of this page begins with a method labeled “Page2View”, this method is responsable for holding all of the Vaadin components such as ComboBoxes, TextFields, TextAreas and Buttons. There is also a section within this method responsible for mapping all of the necessary betting statistics that the user can select, to the actual column names within our data-sets that match.

In order to build the model we would use for our predictions. We used SMILE’s RandomForest Models. We added three different data-sets to our project, one for each sport with all the players we would need, as well as multiple game stats for each player. Essentially, we created a new column to add to the data-set titled “HitTheOver”, this column would only populate with 1’s and 0’s. 1 if the player did hit the over on the current line submitted, 0 if they did not. This is the column that the Random Forest Model was testing and training for. Once the model ran it’s tests multiple times, it produced an accurate prediction for whether or not the player would hit-the-over on that specific player bet. We did this three seperate time, in three seperate methods. Each one titled “runNBAModel”(NHl/MLB)

The second half if each model method pertained to creating the predictions for parlays.The intention was use ORTools to create a way of adding the best previously submitted by user into a parlay, then producing a recommended parlay that encouraged the best payout odds with the highest prediction of hitting. We used a constraint programming model to accomplish this.

These are examples of the filled in GUI

Example of page 2